Skip to content

[workflows] add individual and batch instance deletion - #14735

Open
vaishnav-mk wants to merge 1 commit into
mainfrom
vaish/workflows-instance-delete
Open

[workflows] add individual and batch instance deletion#14735
vaishnav-mk wants to merge 1 commit into
mainfrom
vaish/workflows-instance-delete

Conversation

@vaishnav-mk

@vaishnav-mk vaishnav-mk commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Adds individual and batch Workflow instance deletion to the runtime and SDK.

  • env.MY_WORKFLOW.get(id).delete() deletes one instance.
  • env.MY_WORKFLOW.deleteBatch(instanceIds) returns { deleted, errors } with per-instance results.
  • wrangler workflows instances delete <name> [id..] deletes one or up to 100 instances remotely or in local development; IDs can also come from a JSON array passed with --filename.
  • Missing batch targets are returned as errors; duplicate IDs are processed once.

A picture of a cute animal (not mandatory, but encouraged)
(i want a cat like this :))
image

@changeset-bot

changeset-bot Bot commented Jul 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 94f1156

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
wrangler Minor
miniflare Minor
@cloudflare/vite-plugin Patch
@cloudflare/vitest-pool-workers Patch
@cloudflare/deploy-helpers Patch
@cloudflare/pages-shared Patch
@cloudflare/remote-bindings Patch
@cloudflare/runtime-types Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

✅ All changesets look good

@ask-bonk

ask-bonk Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

I notice a real inconsistency worth flagging. The remote deleteInstance in utils.ts does NOT encodeURIComponent the workflowName or instanceId, while the local variant and other newer remote helpers do. Actually the remote ones (describe line 84, send-event line 79) also don't encode. So it's consistent with the existing remote convention. Not a new bug.

The implementation is consistent, well-tested, and follows established patterns for all sibling commands. The local DELETE route pre-exists in the explorer worker. The engine/binding changes mirror the terminate pattern correctly.

I've reviewed all changed files, the engine abort semantics, the binding pattern, the local-explorer route (pre-existing), CLI wiring, and tests. No actionable logic bugs, security issues, backward-compat violations, or incorrect API behavior found.

LGTM

github run

@pkg-pr-new

pkg-pr-new Bot commented Jul 17, 2026

Copy link
Copy Markdown
@cloudflare/autoconfig

npm i https://pkg.pr.new/@cloudflare/autoconfig@14735

@cloudflare/build-output-utils

npm i https://pkg.pr.new/@cloudflare/build-output-utils@14735

@cloudflare/config

npm i https://pkg.pr.new/@cloudflare/config@14735

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@14735

@cloudflare/deploy-helpers

npm i https://pkg.pr.new/@cloudflare/deploy-helpers@14735

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@14735

miniflare

npm i https://pkg.pr.new/miniflare@14735

@cloudflare/pages-functions

npm i https://pkg.pr.new/@cloudflare/pages-functions@14735

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@14735

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@14735

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@14735

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@14735

@cloudflare/workers-auth

npm i https://pkg.pr.new/@cloudflare/workers-auth@14735

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@14735

@cloudflare/workers-utils

npm i https://pkg.pr.new/@cloudflare/workers-utils@14735

wrangler

npm i https://pkg.pr.new/wrangler@14735

commit: 94f1156

@vaishnav-mk vaishnav-mk changed the title [workflows]: add instance delete support [workflows] add batch instance deletion Jul 19, 2026
@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch from 69f16be to d8999b6 Compare July 23, 2026 09:28
@vaishnav-mk vaishnav-mk changed the title [workflows] add batch instance deletion [workflows] add individual and batch instance deletion Jul 23, 2026
@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch 4 times, most recently from ca9e0b4 to 4053e13 Compare July 23, 2026 10:03
@vaishnav-mk
vaishnav-mk marked this pull request as ready for review July 24, 2026 08:03
@workers-devprod
workers-devprod requested review from a team and emily-shen and removed request for a team July 24, 2026 08:03
@workers-devprod

workers-devprod commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/workflows
  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/workflows-instances-delete.md: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/workflows/wrapped-binding.worker.ts: [@cloudflare/wrangler]
  • packages/miniflare/test/plugins/workflows/index.spec.ts: [@cloudflare/wrangler]
  • packages/workflows-shared/src/binding.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/workflows-shared/src/engine.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/workflows-shared/src/lib/errors.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/workflows-shared/src/types.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/workflows-shared/tests/binding.test.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/wrangler/src/tests/workflows.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/index.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/workflows/commands/instances/delete.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/workflows/local.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/workflows/utils.ts: [@cloudflare/wrangler]

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch 2 times, most recently from 39ff819 to 8e20310 Compare July 24, 2026 08:21
Comment thread packages/wrangler/src/workflows/commands/instances/delete.ts
@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch 3 times, most recently from 0825bc4 to 3086aae Compare July 27, 2026 11:54
@vaishnav-mk
vaishnav-mk requested a review from pombosilva July 27, 2026 11:57
Comment thread .changeset/workflows-instances-delete.md Outdated
Comment thread packages/miniflare/test/plugins/workflows/index.spec.ts
Comment thread packages/miniflare/src/workers/workflows/wrapped-binding.worker.ts Outdated
Comment thread packages/wrangler/src/workflows/local.ts Outdated
Comment thread packages/wrangler/src/workflows/local.ts Outdated
Comment thread packages/wrangler/src/workflows/commands/instances/delete.ts
Comment thread packages/wrangler/src/workflows/commands/instances/delete.ts
Comment thread packages/wrangler/src/workflows/commands/instances/delete.ts
@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch from 3086aae to 832e762 Compare July 29, 2026 15:04
devin-ai-integration[bot]

This comment was marked as resolved.

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch 2 times, most recently from f6d156e to 0146042 Compare July 30, 2026 11:41
devin-ai-integration[bot]

This comment was marked as resolved.

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch 2 times, most recently from ebb790b to 330f310 Compare August 3, 2026 11:06
devin-ai-integration[bot]

This comment was marked as resolved.

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch 4 times, most recently from 28290bf to bec073b Compare August 3, 2026 12:27
devin-ai-integration[bot]

This comment was marked as resolved.

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch from bec073b to 7eae129 Compare August 3, 2026 13:53
devin-ai-integration[bot]

This comment was marked as resolved.

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch 2 times, most recently from 3ed630b to 8c4c047 Compare August 4, 2026 09:08
@workers-devprod

workers-devprod commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Codeowners approval required for this PR:

  • @cloudflare/workflows
  • @cloudflare/wrangler
Show detailed file reviewers
  • .changeset/workflows-instances-delete.md: [@cloudflare/wrangler]
  • packages/miniflare/scripts/openapi-filter-config.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/index.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/plugins/workflows/index.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/local-explorer/explorer.worker.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/local-explorer/generated/index.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/local-explorer/generated/types.gen.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/local-explorer/generated/zod.gen.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/local-explorer/openapi.local.json: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/local-explorer/resources/workflows.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/local-explorer/route-names.ts: [@cloudflare/wrangler]
  • packages/miniflare/src/workers/workflows/wrapped-binding.worker.ts: [@cloudflare/wrangler]
  • packages/miniflare/test/plugins/workflows/index.spec.ts: [@cloudflare/wrangler]
  • packages/miniflare/test/plugins/workflows/wrapped-binding.spec.ts: [@cloudflare/wrangler]
  • packages/miniflare/vitest.config.mts: [@cloudflare/wrangler]
  • packages/workflows-shared/src/binding.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/workflows-shared/src/engine.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/workflows-shared/src/lib/errors.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/workflows-shared/src/types.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/workflows-shared/tests/binding.test.ts: [@cloudflare/workflows @cloudflare/wrangler]
  • packages/wrangler/src/tests/workflows.test.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/index.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/workflows/commands/instances/delete.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/workflows/local.ts: [@cloudflare/wrangler]
  • packages/wrangler/src/workflows/utils.ts: [@cloudflare/wrangler]

devin-ai-integration[bot]

This comment was marked as resolved.

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch from 8c4c047 to 5704618 Compare August 4, 2026 09:18
devin-ai-integration[bot]

This comment was marked as resolved.

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch 6 times, most recently from 96822fe to d3b5bfe Compare August 4, 2026 18:01
devin-ai-integration[bot]

This comment was marked as resolved.

@vaishnav-mk
vaishnav-mk force-pushed the vaish/workflows-instance-delete branch from d3b5bfe to 94f1156 Compare August 4, 2026 18:33

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 new potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread packages/workflows-shared/src/binding.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Untriaged

Development

Successfully merging this pull request may close these issues.

4 participants